﻿@using RBS.Core.Extension
@using RBS.Web.Controllers
@model  RBS.Web.Models.UserOrder
@{
    ViewBag.Title = "订单详情";
    Layout = "~/Views/Shared/_Layout.cshtml";
     var uid = -1;
    if (Request.IsAuthenticated)
    {
        uid = Convert.ToInt32(Context.User.Identity.Name);
    } 
} 
<div id="content">
    <div class="h1a">订单详情</div>
       @{ 
              @Html.Partial("_HotelHead",Model.Hotel);
            } 
     <div id="mainContent"> 
         <div class="tab-content destineorder">
              <dl>
                 <dt>订单状态</dt>
                 <dd style="color: red">
                    @Html.HtmlOrderStatus( Model.Order.OrderState)
                 </dd>
             </dl>
             <dl>
                 <dt>预订吃饭日期</dt>
                 <dd>
                     @Html.DisplayFor(model => model.Order.ReserveDate, null, new { @class = "input small w120", onfocus = "WdatePicker({dateFmt:'yyyy年MM月dd日',minDate:'%y-%M-{%d}'})" })
                     @Html.DisplayFor(model => model.Order.ReserveTime, null, new { @class = "input small w100", onfocus = "WdatePicker({dateFmt:'H时mm分'})" })
                 </dd>
             </dl>
             <dl>
                 <dt>就餐人数</dt>
                 <dd>
                     @Html.DisplayFor(model => model.Order.DineNum, null, new { @class = "input normal w100", datatype = "n", value = "" })
                     <span class="Validform_checktip">人</span>
                 </dd>
             </dl>
             <dl>
                 <dt>餐位情况</dt>
                 <dd class="ltable">
                     @Html.DisplayFor(model => model.Order.Dinecondition) [@{
                                                                               try
                                                                               {
                                                                                 var a= new RBS.Core.BLL.Hotel.H_Hotel_Seat().GetModel(Model.Order.DineTable).Name;
                                                                                   @a;
                                                                               }
                                                                               catch
                                                                               {
                                                                               }
                                                                               } ]
                 </dd>
             </dl>  
             <dl>
                 <dt>联系人</dt>
                 <dd> 
                     @Html.DisplayFor(model => model.Order.ContactUser, null, new { @class = "input normal w100" }) 
                 </dd>
             </dl>
             <dl>
                 <dt>用户手机</dt>
                 <dd>

                     @Html.DisplayFor(model => model.Order.ContactMobile, null, new { @class = "input normal w100" })
                       
                 </dd>
             </dl>
             <dl>
                 <dt>客人信息</dt>
                 <dd> 
                     @{
                         if (Model.OrderGuest != null)
                         {
                             <table>
                                 <tr>
                                     <td class="w200">姓名</td>
                                     <td  class="w120">电话</td>
                                     <td  class="w80">状态</td> 
                                 </tr>
                                 @foreach (var guest in Model.OrderGuest)
                                 {
                                     var user = new RBS.Core.BLL.U_User().GetModelByCache(guest.GuestId);
                                     <tr>
                                         <td>@user.U_Name (@user.U_Uid)</td>
                                         <td>@user.Mobile</td>
                                         <td>
                                             @if (guest.Status == 1)
                                             {
                                                 @Html.Raw("参加")
                                             }
                                             else if (guest.Status == 2)
                                             {
                                                 @Html.Raw("不参加")
                                                 if (Model.Order.U_Id == uid)
                                                 {
                                                     @Html.Raw("</br>【"+guest.Remark+"】")                            
                                                 }
                                             }
                                             else
                                             {
                                                 if (uid == user.Id)
                                                 {
                                                   <a href="javascript:;" onclick="IsParticipate(@Model.Order.Id,1)">[接受]</a> 
                                                    <a href="javascript:;" onclick="IsParticipate(@Model.Order.Id,2)">[拒绝]</a> 
                                                 }
                                                 else
                                                 {
                                                       @Html.Raw("未应答") 
                                                 }
                                              
                                             }

                                         </td> 
                                     </tr>
                                 }
                             </table> 
                         }
                         
                         <script>
                             function IsParticipate(id, s) { 
                                 if(s==2){
                                     $.dialog({
                                         id: 'qx', title: '拒绝原因', width: '710', height: '520', content: $("#jujue").html(), ok: function () {  
                                             var msg=IsParticipate1(id, s, $("#msg").val());
                                             this.reload();
                                             return false;
                                         }  
                                     }); 
                                 }
                                 else
                                 {
                                     IsParticipate1(id, s, "");
                                     window.location.reload();
                                 }
                             } 
                             function IsParticipate1(id, s, remark) { 
                                 var url = '@Url.Action("IsParticipate","Order",new{area="User"})';
                                 $.ajax({
                                     url: url,
                                     type: "post",
                                     dataType: 'json',
                                     data: {
                                         orderid: id,
                                         status: s,
                                         remark: remark 
                                     },
                                     success: function (result) {  
                                         $.dialog.alert(result.Msg);
                                     }
                                 });
                             }
                         </script> 
                         <div  id="jujue" style="display: none" class="tab-content"> 
                        <dl> 
                            <dd>           
                                @Html.TextArea("msg", null, 3, 30, null)
                            </dd> 
                        </dl> 
                        </div>
                     } 
                 </dd>
             </dl>
             <dl>
                 <dt>订单备注</dt>
                 <dd>

                     @Html.DisplayFor(model => model.Order.OrderRemark, null, new { @class = "input normal" })
                       

                 </dd>
             </dl> 
         </div>
         </div>
    <div id="sideContent">  
         <div class="mymenu">
            <h2>我的菜单</h2>
          	<div class="menulist">
                <ul id="orderUL">
                    @{
                        var numcount = 0;
                        decimal priceCount=0;
                            foreach (var item in Model.OrderDetails)
                            {
                                numcount += item.Num;
                                priceCount += (item.Num * item.Price);
                                <li>  
                                    <div class="food-count-name">@item.CName</div>
                                    <div class="food-count-price">@item.Price </div> 
                                      <div class="food-count-reduce"  ></div>
                                    <div class="food-count-num">@item.Num </div> 
                                        <div class="food-count-add">份</div>
                                </li> 
                            }
                       } 
           </ul>
              
               <div class="total-warp">  
					<dl class="price">
						<dd class="item-count">合计数量：<b id="numcount">@numcount</b>份</dd>
						<dd class="item-tit">合计金额：<b>¥</b> <strong id="priceCount">@priceCount </strong></dd>
						<dd class="item-label"></dd>
						<dd class="price-other">菜单金额以实际消费为准</dd>
					</dl>
				@*	<a class="next-btn" href="#" id="BtnNextOrder">下一步</a>*@
				</div>
            </div>
        </div>
        

    </div>
      
     
</div>
 